package edu.sctu.xiangkun.day201506.day20150607.TextOne;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by lenovo on 2015/6/6.
 */
public class DateAndTime {
    public void setDateAndTime(){

        Calendar calendar = Calendar.getInstance();
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG);

        System.out.println("现在时间："+dateFormat.format(calendar.getTime()));

        calendar.set(calendar.YEAR, 2013);
        calendar.set(calendar.MONTH,6);
        calendar.set(calendar.DATE,11);
        calendar.set(calendar.HOUR_OF_DAY,9);
        calendar.set(calendar.MINUTE,30);
        calendar.set(calendar.SECOND,10);
        Date date1 = calendar.getTime();
        System.out.println("当时时间："+dateFormat.format(date1));
        
    }
}
